<?
##########################################################################
#		DOCUMENTATION
##########################################################################
# Class that extends the rootclass. This module will provide the methods
# needed to render the editors page. 
#
# © LiberLab group, 2011
##########################################################################

require_once("base/baseList.php");
require_once("dataStructure/editor.php");

class Renderer extends BaseList{
	public function __construct() {
		parent::__construct("editors", "editors");
	}
	
	public function main(){
		$editorClass = new Editor();
		$this->tagHash["editorNameINDEX§§§§editorDataINDEX"] = $this->limit;
		# PDO Object
		$editors = $editorClass->getEditors($this->limit+1, $this->startId);
		$numBooks = 0;
		foreach($editors as $index => $row){
			$dataBox = $this->messages["dataBox"];
			$this->tagHash["editorName$index"] = $row["name"];
			$orphan = $row["orphanFrom"];
			if (!$orphan){
				$orphan = $this->messages["active"];
			}
			$this->tagHash["editorData$index"] = str_replace("__orphanFrom__",$orphan, 
												 str_replace("__address__", $row["address"],  
												 str_replace("__email__", $row["email"], $dataBox)));
			$numBooks++;
		}
		$numBooks--; # we load one more editor to know if there are any left
		$this->prevNext($numBooks);
		return $this->render();
	}

	public function __destruct() {
		parent::__destruct();
	}
};

?>
